@include("user.head")
	<!-- 公共头部 -->
	<div id="content_person">
	<div class="row">
		<div class="col-xs-3">
		@include('user.uc.navigation')
		</div>
		<div class="col-xs-9">
			<div class="person_right">
				<div class="yndw_info">
					<div class="form-horizontal">
					  <fieldset>
					    <legend>测量仪器</legend>
					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">设备名称</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size" name="name" placeholder="" type="text">
					      </div>
					    </div>

					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">设备台数</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size" name="num" placeholder="" type="text">
					      </div>
					    </div>
					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">生产日期</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size date-time-picker" readonly name="product_time" placeholder="" type="text">
					      </div>
					    </div>

					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">测试功能</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size" name="functions" placeholder="" type="text">
					      </div>
					    </div>
					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">测量范围的最小值</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size" name="minimize" placeholder="" type="text">
					      </div>
					    </div>

					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">测量范围的最大值</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size" name="maximize" placeholder="" type="text">
					      </div>
					    </div>

					    <div class="form-group">
					      <label class="col-xs-3 control-label label_size">制造商</label>
					      <div class="col-xs-6">
					        <input class="form-control input_size" name="creator" placeholder="" type="text">
					      </div>
					    </div>
					    <div class="form-group">
					      <div class="col-xs-6 col-xs-offset-2">
					        <button type="button" id="sub" class="btn btn-primary ">保存修改</button>
					      </div>
					    </div>
					  </fieldset>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>

	<!-- 公共底部 -->
	@include("user.footer")
	<!-- 公共底部 -->
	@include("user.common")
</body>
<script type="text/javascript">
var tid;
var url = "edit_instrument/add";
if("<%Input::has('tid')%>")
{
	tid = "<%Input::get('tid')%>";
	$.get("edit_instrument/get", {tid : tid}, function (data){
		if(data.success)
		{
			$("input[name='name']").val(data.name);
			$("input[name='num']").val(data.num);
			$("input[name='functions']").val(data.functions);
			$("input[name='minimize']").val(data.minimize);
			$("input[name='maximize']").val(data.maximize);
			$("input[name='creator']").val(data.creator);
			$("input[name='product_time']").val(data.product_time);
			url = "edit_instrument/update";
		}
	})
}





$("#sub").bind("click", function(){
	var name 		= $("input[name='name']").val().trim();
	var num 		= $("input[name='num']").val().trim();
	var functions 	= $("input[name='functions']").val().trim();
	var minimize 	= $("input[name='minimize']").val().trim();
	var maximize 	= $("input[name='maximize']").val().trim();
	var creator 	= $("input[name='creator']").val().trim();
	var product_time = $("input[name='product_time']").val().trim();

	if(name == '' || num == '' || functions == '' || minimize == '' || maximize == '' || creator == '' || product_time == '')
	{
		warning("", "必填内容不能为空");
		return;
	}

	$.post(url, {
		name : name,
		num : num,
		functions : functions,
		minimize : minimize,
		maximize : maximize,
		creator : creator,
		product_time : product_time,
		tid : tid
	}, function (data){
		if(data.success)
		{
			success("", "提交成功");
			setTimeout(function(){
				window.location.reload();
			}, 2000)
		}
	})

})



$("#Form").ajaxForm(function(data){
	if(data.success){
		success('', '提交成功');
	}
})


</script>
</html>